package com.siemens.industrial.web.mvc.dao.admin;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by Yipin on 2016/11/23.
 */
@Service
public class DBBackupLogDao {
    @Resource
    JdbcTemplate jdbcTemplate;

    private static final String findAllDBBackupLog = "select date_format(backup_time,'%Y-%m-%d %H:%i:%s') backupTime," +
            "backup_type, backup_file,case when backup_status = -1 then '进行中' when backup_status = 0 then '成功' " +
            "when backup_status = 1 then '失败' end status from `siemens`.`db_backup_log`";

    public List<Map<String,Object>> getDBBackupLog(){
        return jdbcTemplate.queryForList(findAllDBBackupLog);
    }
}
